package com.aoxin.service.impl.course.webCourse;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import com.aoxin.mapper.SlfActivityRuleMapper;
import com.aoxin.model.SlfActivityRule;
import com.aoxin.service.inter.course.webCourse.ActivityRuleService;
import com.aoxin.util.ErrorUtil;

@Service
public class ActivityRuleServiceImpl implements ActivityRuleService {

    @Autowired
    private SlfActivityRuleMapper slfActivityRuleMapper;

    @Override
    @Transactional
    public Integer deleteSlfActivityRule(List<Integer> activityRuleId) {
        Assert.notNull(activityRuleId,String.format(ErrorUtil.SLFACTIVITYRULE,"activityRuleId"));
        Integer integer = 0;
        if (activityRuleId !=null){
           integer= slfActivityRuleMapper.deleteSlfActivityRule(activityRuleId);
        }
        return integer;
    }

    @Override
    @Transactional
    public Integer insertSlfActivityRule(SlfActivityRule slfActivityRule) {
        Assert.notNull(slfActivityRule,String.format(ErrorUtil.SLFACTIVITYRULE,"slfActivityRule"));
                    Integer integer = 0;
        if (slfActivityRule !=null){
            integer=slfActivityRuleMapper.insertSlfActivityRule(slfActivityRule);
        }
        return integer;
    }

    @Override
    public List<SlfActivityRule> getSlfActivityRule(SlfActivityRule slfActivityRule) {
        Assert.notNull(slfActivityRule,String.format(ErrorUtil.SLFACTIVITYRULE,"slfActivityRule"));
        List<SlfActivityRule> list = slfActivityRuleMapper.getSlfActivityRule(slfActivityRule);
        return list;
    }

    @Override
    @Transactional
    public Integer updateSlfActivityRule(SlfActivityRule slfActivityRule) {
        Assert.notNull(slfActivityRule,String.format(ErrorUtil.SLFACTIVITYRULE,"slfActivityRule"));
        Integer integer=0;
        if (slfActivityRule !=null){
            integer= slfActivityRuleMapper.updateSlfActivityRule(slfActivityRule);
        }
        return integer;
    }

    @Override
    public List<SlfActivityRule> getBySlfActivityRule(SlfActivityRule slfActivityRule) {
        List<SlfActivityRule> list=slfActivityRuleMapper.getBySlfActivityRule(slfActivityRule);
        return list;
    }
}
